$(document).ready(function(){
 WxTest.init();
}); 
var WxTest={
	isWX:false,
	gatewayId:window.gatewayId,
	listData:null,
	init:function(){
			this.addLisen();
		},
		getUrlParm:function(name){
			//构造一个含有目标参数的正则表达式对象  
    		var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");  
    		//匹配目标参数  
    		var r = window.location.search.substr(1).match(reg);  
    		//返回参数值  
   			 if (r!=null) return unescape(r[2]);  
    			return null; 
		},
		getData:function(url,type,parm){
			//var url="/gateway-cms/"+url;
			$.ajax({
					type : 'post',
					url :  url ,
					dataType : 'json',
					data:parm,
					async : true,
					cache : false,
					success : function(data) {
						if (data.code != 200) {
							if (data.msg)
								alert(data.msg);
							return;
						}
						alert("验证通过");
					},
					error : function(XMLHttpRequest, textStatus, errorThrown) {
						alert(XMLHttpRequest.status);
						 alert(XMLHttpRequest.readyState);
						 alert(textStatus);
					}
				});
		},
		parseDate:function(data,type){
			var list=data.data;
			if(type==1){
				this.showPop(list);
			}
			 
		},
		
		showPop:function(list){
			var html="";
			this.listData=list;
			if(list.length==0){
				$("#contTable tbody").html("无数据");
				return;
			}
			for(var t in list){
			
				html+="";
			}
			$("#contTable tbody").html(html);
		},
		//注册事件
		addLisen:function(){
			var o=this;
			$('body').on('click', '#tj', function() {
				//验证
				var listurl="vgpwd";
				var parm={};
					  parm.id=o.gatewayId;
					  parm.validatePwd=$("#validatePwd").val();
				o.getData(listurl,1,parm);
			});
		}
}
